/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.nms.entities;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author mohamedemara
 */
@Entity
@Table(name = "WORKS_IN")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "WorksIn.findAll", query = "SELECT w FROM WorksIn w"),
    @NamedQuery(name = "WorksIn.findByOfferId", query = "SELECT w FROM WorksIn w WHERE w.worksInPK.offerId = :offerId"),
    @NamedQuery(name = "WorksIn.findByCustomerId", query = "SELECT w FROM WorksIn w WHERE w.worksInPK.customerId = :customerId"),
    @NamedQuery(name = "WorksIn.findByWorkDate", query = "SELECT w FROM WorksIn w WHERE w.worksInPK.workDate = :workDate"),
    @NamedQuery(name = "WorksIn.findByPaidSys", query = "SELECT w FROM WorksIn w WHERE w.paidSys = :paidSys")})
public class WorksIn implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected WorksInPK worksInPK;
    @Basic(optional = false)
    @NotNull
    @Column(name = "paidSys")
    private int paidSys;

    public WorksIn() {
    }

    public WorksIn(WorksInPK worksInPK) {
        this.worksInPK = worksInPK;
    }

    public WorksIn(WorksInPK worksInPK, int paidSys) {
        this.worksInPK = worksInPK;
        this.paidSys = paidSys;
    }

    public WorksIn(String offerId, String customerId, Date workDate) {
        this.worksInPK = new WorksInPK(offerId, customerId, workDate);
    }

    public WorksInPK getWorksInPK() {
        return worksInPK;
    }

    public void setWorksInPK(WorksInPK worksInPK) {
        this.worksInPK = worksInPK;
    }

    public int getPaidSys() {
        return paidSys;
    }

    public void setPaidSys(int paidSys) {
        this.paidSys = paidSys;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (worksInPK != null ? worksInPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof WorksIn)) {
            return false;
        }
        WorksIn other = (WorksIn) object;
        if ((this.worksInPK == null && other.worksInPK != null) || (this.worksInPK != null && !this.worksInPK.equals(other.worksInPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.nms.entities.WorksIn[ worksInPK=" + worksInPK + " ]";
    }
    
}
